package com.example.nacosdemo.nacosconfcontroller;

import com.alibaba.nacos.api.config.annotation.NacosValue;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;


@RestController
@RequestMapping("/api/config")
public class ConfigController {


    @NacosValue(value = "${useLocalCache:false}", autoRefreshed = true)
    private boolean useLocalCache;

    @NacosValue(value = "${config1:null}", autoRefreshed = true)
    private String nacosdemoconfig;

    @RequestMapping(value = "/get/value", method = RequestMethod.GET)
    private Boolean get() {
        return useLocalCache;
    }

    @RequestMapping(value = "/get/nacos/config", method = RequestMethod.GET)
    private String getnacoscofnig() {
        return nacosdemoconfig;
    }


}
